package com.zxt.redis.utils;

import com.zxt.redis.utils.RedisUtil;
import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.TimeUnit;

@Slf4j
public class RedisExceptionUtil {

    public static void set(String key, Object value, TimeUnit unit, long timeout) {
        try {
            RedisUtil.set(key, value, TimeUnit.MINUTES, 30);
        } catch (Exception e) {
            log.error("设置redis Key报错 异常信息：{}", e);
        }
    }

    public static void delete(String key) {
        try {
            RedisUtil.delete(key);
        } catch (Exception e) {
            log.error("删除redis Key报错 异常信息：{}", e);
        }
    }

    public static Object get(String key) {
        try {
            return RedisUtil.get(key);
        } catch (Exception e) {
            log.error("获取redis Key报错 异常信息：{}", e);
        }
        return null;
    }
}
